﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 泛型集合练习
{
    class Student
    {
        private string _name;
        private int _num;
        private int _age;

        public Student(string name, int num, int age)
        {
            _name = name;
            _num = num;
            _age = age;
        }

        public string Name { get => _name; set => _name = value; }
        public int Num { get => _num; set => _num = value; }
        public int Age { get => _age; set => _age = value; }



        public override string ToString()
        {
            return $"学号{Num}，姓名{Name}，年龄{Age}";

        }
    } class NumCompare : IComparer<Student>
    {
        public int Compare(Student x, Student y)
        {
            return x.Num.CompareTo(y.Num);
        }
    }
}
